package com.ellricky.excute_president.ui.activity

import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.core.content.ContextCompat
import com.andr.common.ui.activity.BaseActivity
import com.andr.common.ui.mvp.BasePresenter
import com.andr.common.widget.bnb.BnbUtil
import com.ellricky.baselib.cache.LocalCacheUtil
import com.ellricky.baselib.ui.SchoolOverviewFragment
import com.ellricky.baselib.ui.order.StudentWorksFragment
import com.ellricky.baselib.ui.visit.VisitFragment
import com.ellricky.baselib.util.EAppUtil
import com.ellricky.excute_president.R
import com.ellricky.excute_president.ui.fragment.*
import kotlinx.android.synthetic.main.common_toolbar.*
import kotlinx.android.synthetic.main.pd_activity_main.*

/**
 * 校长端主界面
 */
class PresidentMainActivity : BaseActivity<Void, BasePresenter<Void>>() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        LocalCacheUtil.setIsReloadData(true)
    }

    override fun getContentLayout(): Int {
        return R.layout.pd_activity_main
    }

    override fun initUIView() {
        mainView.initVP(
            listOf(
                PresidentMainFragment.newInstance(),
                EmployeeManageFragment.newInstance(),
                VisitFragment.newInstance(),
                StudentWorksFragment.newInstance(),
                SchoolOverviewFragment.newInstance(Bundle())
            ), supportFragmentManager
        )

        mainView.initBnb(
            mutableListOf(
                BnbUtil.addBnbItem(
                    this,
                    R.drawable.pd_icon_home_sel,
                    R.drawable.pd_icon_home_nor,
                    R.string.pd_home
                ),
                BnbUtil.addBnbItem(
                    this,
                    R.drawable.base_icon_employee_select,
                    R.drawable.base_icon_employee_normal,
                    R.string.base_employee_manage
                ),
                BnbUtil.addBnbItem(
                    this,
                    R.drawable.pd_icon_joinin_sel,
                    R.drawable.pd_icon_joinin_nor,
                    R.string.base_visit_list_2
                ),
                BnbUtil.addBnbItem(
                    this,
                    R.drawable.pd_icon_am_sel,
                    R.drawable.pd_icon_am_nor,
                    R.string.base_student_work
                ),
                BnbUtil.addBnbItem(
                    this,
                    R.drawable.pd_icon_overview_sel,
                    R.drawable.pd_icon_overview_nor,
                    R.string.pd_school_overview
                )
            )
        )


    }



    override fun onPause() {
        super.onPause()
        LocalCacheUtil.setIsReloadData(false)
    }

    override fun onKeyBack(isKeyBack: Boolean) {
        EAppUtil.exitApp(this)
    }
}
